package cn.slipi.common.response;

import com.fasterxml.jackson.annotation.JsonInclude;

/**
 * @param <T>
 * @author lee
 */

@JsonInclude(JsonInclude.Include.NON_NULL)
public class Response<T> {

    private int code;

    private String msg;

    private T data;

    public Response() {
        this.code = 0;
        this.msg = "success";
    }

    public Response(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Response(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public Response<T> setCode(int code) {
        this.code = code;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public Response<T> setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public T getData() {
        return data;
    }

    public Response<T> setData(T data) {
        this.data = data;
        return this;
    }
}
